<?php

$navigator = NULL;

if (!isset($_SESSION['nav']) || $_SERVER['PHP_SELF']=='/cms-cs/index.php') {
    $navigator = new Navigator();
    $_SESSION['nav'] = serialize($navigator);
}

$navigator = unserialize($_SESSION['nav']);

echo "<nav>";
$stacks = $navigator->stack;
foreach ($stacks as $value) {
    if ($value->id == 0) {
        echo "<a href=\"$value->url\">$value->name</a>";
    } else {
        echo "<a href=\"$value->url?id=$value->id\">$value->name</a>";
    }
}

echo "</nav>";
?>
